home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 019a / amac40.zip / COM003.QM < prev    next >
Text File  |  1991-07-28  |  22KB  |  459 lines

  1. *                               COM003.QM
  2. *                        Written By Tom Hogshead
  3. *                       [ See COMTxx.QM For Use ]
  4. *                             July 28, 1991
  5. *  Key                         Description
  6. * =====   ===============================================================
  7. * @(8)    Insert Text at Beginning of Blocked Lines (or Current
  8. *         Line If No Blocks Marked), John Goodman, Author
  9. *
  10. * #(F4__)-Surround Column-Blocked Text With Box Of Desired Characters,
  11. *             (John Goodman, Author)
  12. *                                   ********
  13. *         (Box Drawn Around Outside *Border* Of Column Block, Juxtapose Text)
  14. *                                   ********
  15. *
  16. * @(F4__)-Erase Outside Border Of Column-Blocked Text And Collapse Text
  17. *         Surronding Block To Original Position Before Box Was Made,
  18. *             (John Goodman, Author)
  19. *
  20. * @(F8) --Put Colon In Front Of "Rem" Lines For Faster Batch File Operation
  21. *
  22. * ^(F7_)--Prepend Prompted Text To, Or Delete Prompted Text From,
  23. *         The Beginning Of The Current Or Blocked Line(s),
  24. *             (John Goodman, Author)
  25. *
  26. * #(F7__)-Prepend Prompted Text To, Or Delete Prompted Text From,
  27. *         The Beginning Of The Current Or Blocked Line(s),
  28. *         Initialize Find Prompt With Last Prompted Text
  29. *             (Tom Hogshead Modification Of ^F7)
  30. *
  31. * @(F7) --Insert Text At Beginning Of All Blocked Lines,
  32. *             (John Goodman, Author)
  33. *
  34. *
  35. *  (_)  --{e:\up\COMT*}--Return To COMTxx.QM
  36. *
  37. *-- eoi
  38.  
  39. *
  40.  
  41. * 
  42. * ----------------------------------------------------------------------
  43. * #(F4__) Surround Column-Blocked Text with Box of Desired Characters,
  44. *         John Goodman, author
  45.                                    ********
  46. *        (Box Drawn Around Outside *Border* of Column Block, Juxtapose Text)
  47.                                    ********
  48. * ----------------------------------------------------------------------
  49.  
  50. * The following macro surrounds column-blocked text with a box of desired
  51. * characters. Place text to be surrounded in a column block and press
  52. * #F4. At the FillBlock prompt enter the desired border character. Box
  53. * size is unlimited, including empty boxes, and boxes of one character
  54. * up to surrounding full documents.  Macro is INSERT mode insensitive,
  55. * and there are no Find beeps because of failed searches. This macro
  56. * was written by John Goodman.
  57.  
  58. * Starting with a block like this:
  59.  
  60. *         12345678901234567890
  61. *         12345678901234567890
  62. *         12345678901234567890
  63. *         12345678901234567890
  64. *         12345678901234567890
  65.  
  66. * Macro #F4 does this . . .
  67.  
  68. *         12345678901234567890
  69.                **********
  70. *         12345*67890123*4567890
  71. *         12345*67890123*4567890
  72. *         12345*67890123*4567890
  73.                **********
  74. *         12345678901234567890
  75.  
  76. #F4  macrobegin
  77.     GotoBlockBeg            * Try going to block beg
  78.  JTrue START:               * If we can, start processing
  79.     MarkColumn              * Try completing the block
  80.     GotoBlockBeg            * Try again to go to block beg
  81.  JFalse END:                * If we can't, no block there
  82.  START:
  83.     Copy PasteOver          * Copy the block and paste it back
  84.     InsertLine              * Insert blank line at top
  85.     MarkLine                * Make column block a line block
  86.     GotoBlockEnd            * (Line) block end is directly below!
  87.     MarkColumn              * Start a single column block
  88.     PrevPosition            * Go back to where block began
  89.     CopyBlock CopyBlock     * Copy column twice to shift text
  90.     CursorDown              * Move down to reset block position
  91.     PasteOver               * Paste orig block back in
  92.     CursorUp                * Move to upper right of outer block
  93.     MarkColumn              * Reset upper right corner
  94.     GotoBlockEnd            * Go to block end
  95.     CursorRight             * Move to where outer block will end
  96.     AddLine                 * Add extra line at bottom
  97.     MarkColumn              * Mark outer block end point
  98.     FillBlock Pause Return  * Prompt user for fill character
  99.     GotoBlockBeg            * Go to outer block begin
  100.     CursorDown CursorRight  * Move in for inner block
  101.     PasteOver               * Put original block back in
  102.     UnmarkBlock             * Clean up and go home!
  103.  END:
  104. *
  105. * 38 bytes Tue  05-07-1991  17:46:32
  106.  
  107. * 
  108. * ----------------------------------------------------------------------
  109. * @(F4_)   Erase Outside Border of Column-Blocked Text and Collapse Text
  110. *          Surronding Block to Original Position Before Box Was Made
  111. *          John Goodman, author
  112. * ----------------------------------------------------------------------
  113.  
  114. * Mark box border as a column block. @F4 erases outside border, returns
  115. * and collapses all text surrounding block to original position before
  116. * box was made.  Use with caution since the lines containing the top
  117. * and bottom edges of the block are deleted.
  118.  
  119. @F4 MacroBegin
  120.     GotoBlockBeg             * Try going to block begin
  121.  JTrue START:                * If we can, begin processing
  122.     MarkColumn               * If not, mark block end
  123.     GotoBlockBeg             * Try again to go to block begin
  124.  JFalse END:                 * If we can't, no block
  125.  START:
  126.     ShiftRight               * Remove right edge of box
  127.     GotoBlockEnd             * Go to end of block
  128.     MarkLine                 * Start Line block
  129.     PrevPosition             * Return to block begin
  130.     GotoBlockEnd             * new block end is directly below
  131.     MarkColumn               * Start single column block
  132.     PrevPosition             * Return to old block begin
  133.     CursorRight              * Create 2-column block
  134.     MarkColumn               * Finish marking block
  135.     DelLine                  * Delete top edge of box
  136.     GotoBlockEnd             * Go to last line of block
  137.     DelLine                  * Delete bottom edge of box
  138.     DeleteBlock              * Delete 1st two columns of block
  139.  END:
  140. *
  141. * 26 bytes Wed  05-08-1991  15:36:31
  142.  
  143. * 
  144. * ---------------------------------------------------------------
  145. * @(F7)  Insert Text at Beginning of All Blocked Lines (J GOODMAN)
  146. * ---------------------------------------------------------------
  147. *
  148. @F7 MacroBegin
  149.         CursorRight           * Needed for single-line blocks
  150.         GotoBlockBeg          * Try going to block beg, retain pos.
  151.    JTrue BLK:                 * Determine if a completed block
  152.         DropAnchor            * If not, DropAnchor will finish it
  153.                               * or mark current line if none started
  154.         GotoBlockBeg          * Go to block beg to retain position
  155.    BLK: GotoBlockEnd          * Start at the end
  156.         FindReplace           * Dummy to Allow for Safe Macro Escape
  157.           #224 Return         *  Char Unlikely to be Found
  158.           Pause Return        *  Allow User to Enter Repl Text
  159.           "LN" Return         *  Local, No Prompt Replace
  160.         MarkLine              * Mark first line
  161.         PrevPosition          * Return to beg of where block was
  162.         ShiftRight            * Shift all lines to right
  163.         BegLine               * Move cursor to column 1
  164.         GotoBlockEnd          * Move to 1st char of last line
  165.         MarkColumn            * Mark 1st character column
  166.         PrevPosition          * Return to first line
  167.         BegLine               * Needed for single-line blocks
  168.         FillBlock             * Fill First Column with Char
  169.           #224 Return         *  Searched For Above
  170.         RepeatFind            * Repeat the FindReplace
  171.         UnmarkBlock           * Unmark the block
  172. * 37 bytes Wed  04-17-1991  21:02:33
  173.  
  174. * =========================================================================
  175. * Date: 05-01-91 (00:21)           Number: 275          SemWare Support BBS
  176. *   To: TOM HOGSHEAD               Refer#: NONE
  177. * From: JOHN GOODMAN                 Read: NO
  178. * Subj: MORE FOR REX                 Conf: 3 Macros
  179. * ------------------------------------------------------------------------
  180. * To Tom and Rex Edwards--
  181. *
  182. * Rex, I'm glad you're finding the comment macros useful!  I hope
  183. * Tom's followup comments will do the trick for you; I couldn't
  184. * have recommended anything better.
  185. *
  186. *» Not to let Tom have the last word, however...
  187. *» The following macro is a first (very rough) attempt to merge
  188. *» together the ideas in the comment/uncomment macro and the macro
  189. *» that prepends a user-prompted string of text to blocked lines or
  190. *» the current line (the idea for the second macro originated with
  191. *» Richard Blackburn and it has been refined since then--I'm not
  192. *» sure where Tom has put it in the AMAC files).
  193. * The macro below works the same as the comment/uncomment macro
  194. * except that it will prompt for a text string.  If the text string
  195. * is found at the beginning of the 1st line of the block, the macro
  196. * will delete that number of characters from the beginning of every
  197. * line in the block.  If the string is not found, it will add the
  198. * string to the beginning of every line in the block.
  199. *
  200. */ I have not had a chance to thoroughly test the macro or to try to
  201. */ streamline it, but I wanted to throw it out for comment (sic).
  202. */
  203. * >>Tom, I'm running up against a deadline here at my real (i.e.,
  204. * >>paying) job and may not be able to provide any further input on
  205. * >>the JMPPOS macros for a couple of days.  I scanned the last set
  206. * >>you sent and everything looks great!  Please don't let me hold
  207. * >>you up if you want to get it out quickly.
  208. * >>
  209. * >>...JDG
  210. *
  211. * (Comments above added, deleted, then added again by #F7)                |1.5
  212.  
  213. * 
  214. * -------------------------------------------------------------------
  215. * ^(F7_) Prepend Prompted Text to, or Delete Prompted Text from,
  216. *      The Beginning of the Current or Blocked Line(s)
  217. * -------------------------------------------------------------------
  218.  
  219. * (Note: I have changed John's character #128 to @250 so as to not be as
  220. *  noticeable.)
  221.  
  222. ^F7   MacroBegin
  223.       CursorRight           * Needed for single-line blocks
  224.       GotoBlockBeg          * Try going to block beg, retain pos.
  225.  JTrue BLK:                 * Determine if a completed block
  226.       DropAnchor            * If not, DropAnchor will finish it
  227.                             * or mark current line if none started
  228.       GotoBlockBeg          * Go to block beg to retain position
  229.  BLK: GotoBlockEnd          * Start at the end
  230.       MarkLine              * Mark line to close block
  231.       PrevPosition          * Return to block begin
  232.       ShiftRight            * Shift all lines to right
  233.       BegLine               * Move cursor to column 1
  234.       GotoBlockEnd          * Move to 1st char of last line
  235.       MarkColumn            * Mark 1st character column
  236.       PrevPosition          * Return to first line
  237.       BegLine               * Needed for single-line blocks
  238.       FillBlock             * FillBlock w/weird character
  239.        #250 Return
  240.       FindReplace           * Replace Weird Char on 1st Line
  241.        #250 Return          *  with user-prompted text
  242.        DelLine
  243.        Pause #250 Return
  244.        "1" Return           *  1st Occurrence (Line) Only
  245.       UnmarkBlock           * Unmark the block
  246.       CursorLeft
  247.       MarkCharacter         * Block the User's Text
  248.       BegLine
  249.       Cut                   * Cut Buffer Now Has Prompted Text
  250.       AddLine Paste         * Save text on the following line
  251.       Find #250 Paste Return  * Try to find weird char+text
  252.        "B" Return             *  on 1st line
  253.  JTrue DELTEXT:
  254.                               * Text not found, add to every line
  255.       DelLine                 * Delete temp line
  256.       FindReplace #250 Return * Replace all occurrences of weird
  257.        Paste Return           *  char with user's text
  258.        "GN" Return
  259.  Jump END:
  260.  DELTEXT:                     * Text not found, shift right
  261.       GotoBlockEnd            * Go to end of saved copy
  262.       DelLine                 * get rid of temp line
  263.       CursorUp                * go back to 1st line in same col
  264.       MarkColumn              * start col block, upper right
  265.       Find #250 Return        * find last weird char, this becomes
  266.        "GB" Return            *  lower left corner of col block
  267.       DeleteBlock             * delete the column block
  268.       CursorDown              * reposition to run again
  269.  END:
  270. *
  271. * 84 bytes Tue  04-30-1991  23:51:49
  272.  
  273. * 
  274. * -------------------------------------------------------------------
  275. * #(F7__) Prepend Prompted Text to, or Delete Prompted Text from,
  276. *         The Beginning of the Current or Blocked Line(s),
  277. *         Initialize Find prompt with last prompted text
  278. * -------------------------------------------------------------------
  279.  
  280. * I changed John's ^F7 macro a bit so that the last prompt is
  281. * remembered by Find. This is helpful for repetitive entries.
  282.  
  283. #F7   MacroBegin
  284.       CursorRight           * Needed for single-line blocks
  285.       GotoBlockBeg          * Try going to block beg, retain pos.
  286.  JTrue BLK:                 * Determine if a completed block
  287.       DropAnchor            * If not, DropAnchor will finish it
  288.                             * or mark current line if none started
  289.       GotoBlockBeg          * Go to block beg to retain position
  290.  BLK: GotoBlockEnd          * Start at the end
  291.       MarkLine              * Mark line to close block
  292.       PrevPosition          * Return to block begin
  293.       ShiftRight            * Shift all lines to right
  294.       BegLine               * Move cursor to column 1
  295.       GotoBlockEnd          * Move to 1st char of last line
  296.       MarkColumn            * Mark 1st character column
  297.       PrevPosition          * Return to first line
  298.       BegLine               * Needed for single-line blocks
  299.       FillBlock             * FillBlock w/weird character
  300.        #250 Return
  301.       FindReplace           * Replace Weird Char on 1st Line
  302.        #250 Return          *  with user-prompted text
  303. *       DelLine
  304.        CursorRight                                                    *|
  305.        Pause #250 Return
  306.        "1" Return           *  1st Occurrence (Line) Only
  307.       UnmarkBlock           * Unmark the block
  308.       CursorLeft
  309.       MarkCharacter         * Block the User's Text
  310.       BegLine
  311.       Cut                   * Cut Buffer Now Has Prompted Text
  312.       AddLine Paste         * Save text on the following line
  313.       Find #250 Paste Return  * Try to find weird char+text
  314.        "B" Return             *  on 1st line
  315.  JTrue DELTEXT:
  316.                               * Text not found, add to every line
  317.       DelLine                 * Delete temp line
  318.       FindReplace #250 Return * Replace all occurrences of weird
  319.        Paste Return           *  char with user's text
  320.        "GN" Return
  321.  Jump END:
  322.  DELTEXT:                     * Text not found, shift right
  323.       GotoBlockEnd            * Go to end of saved copy
  324.       DelLine                 * get rid of temp line
  325.       CursorUp                * go back to 1st line in same col
  326.       MarkColumn              * start col block, upper right
  327.       Find #250 Return        * find last weird char, this becomes
  328.        "GB" Return            *  lower left corner of col block
  329.       DeleteBlock             * delete the column block
  330.       CursorDown              * reposition to run again
  331.  END:                         *
  332.       FindReplace Return      *                                       *|
  333.       Paste                   * Re-initialize Find prompt with        *|
  334.                               *  prompted text                        *|
  335.       Return Escape           * Cancel FindReplace                    *|
  336. *
  337. * 84 bytes Tue  04-30-1991  23:51:49 (JG ^F7)
  338. * 89 bytes Thu  05-02-1991  10:24:01 (TH |)
  339.  
  340. * 
  341. * ---------------------------------------------------------------------
  342. * @(F8)  Put colon in front of *rem* line for faster batch file operation
  343. * ---------------------------------------------------------------------
  344. *
  345. * "Rem" lines in batch files make batch files run slower. Lines which
  346. * are labels (colon as first character) do not. This macro simply puts
  347. * a colon in column 1 for each line containing "rem ". Each rem line
  348. * for my system takes about 0.2 seconds with disk cache, and 0.5 seconds
  349. * per line with no disk cache. I found one batch file with 30 plus
  350. * rem lines - 15 seconds less running time by labelling rem lines!
  351. *
  352. * NOTE:  At least a space and one character of text must follow "rem"
  353. * to be labelled, eg the following would not be labeled:
  354. *       rem
  355. *       echo remember
  356. * The following would be labeled:
  357. *       rem  this is a test
  358. *       echo harem holiday!
  359. *              
  360. *
  361. @F8     MacroBegin                      *
  362.         Begfile InsertLine              * Insert blank line in case
  363.                                         * rem in col/line 1/1
  364.         Editfile "c:\!" Return          * Load temp file
  365.         KillFile Quit                   * To kill/quit it
  366.         EditFile Return                 * Load empty temp file and
  367.         SaveFile                        * save it for append later
  368.         Quit                            * Quit it for now
  369.  START:                                 *
  370.         Unmarkblock                     *
  371.         Find "rem " Return "I " Return  * Find "rem "
  372.         Jfalse END:                     * No rem lines, end macro
  373.         BegLine                         *ELSE line has rem, go to bol
  374.         Dropanchor Wordright Dropanchor * Mark space up to "rem"
  375.         Shiftright                      * Shift line rt one space
  376.         Begline                         * Bak to bol
  377.         Find ":" Return "L" Return      * See if line has colon at beg
  378.         Jtrue NEXT:                     *
  379.         Cursorright ":"                 *ELSE line has no colon, add it!
  380.  NEXT:                                  *
  381.         Shiftleft                       * Shift line back lft one space
  382.         Markline                        *
  383.         WriteBlock Return "A"           * Append line to c:\!
  384.         Endline Cursordown              * Move off rem and chk for last
  385.         Jfalse END:                     *                          line
  386.         Cursorup                        *ELSE Line is not last, cur up
  387.         Jump START:                     * Loop again
  388.  END:                                   *
  389.         Begfile                         * Begin of batch file
  390.         DelLine                         * Delete top blank line
  391.         Editfile Return                 * Load c:\!, look at rem lines
  392.         DelLine KillFile                * with added colon, kill file
  393.         UnMarkBlock                     * Un mark batch file
  394.  
  395. *
  396. * 82 bytes Mon  03-25-1991  16:49:26
  397.  
  398. * 
  399. * -----------------------------------------------------------
  400. * @(8) Insert Text at Beginning of Blocked Lines (or Current
  401. *      Line If No Blocks Marked)
  402. * -----------------------------------------------------------
  403. * This macro will insert a user-prompted string of text in front of
  404. * each line delineated by any type of block (character, line, or
  405. * column).  Only one block marker need be set.  If no block markers
  406. * are set, the current line will be acted upon.  The text to be
  407. * prepended should be entered by the user at the "Replace with:"
  408. * prompt.
  409. *
  410. * The cursor will be placed at the beginning of the line following
  411. * the line(s) acted upon so that the macro can be invoked
  412. * repeatedly to prepend text to a series of lines.  The macro
  413. * should work consistently regardless of toggle mode or QConfig
  414. * settings.
  415. *
  416. @8 MacroBegin
  417.         CursorRight     * Needed for single-line blocks
  418.         GotoBlockBeg    * Try going to block beg, retain pos.
  419.    JTrue BLK:           * Determine if a completed block
  420.         DropAnchor      * If not, DropAnchor will finish it
  421.                         * or mark current line if none started
  422.         GotoBlockBeg    * Go to block beg to retain position
  423.    BLK: GotoBlockEnd    * Start at the end
  424.         FindReplace     * Dummy to Allow for Safe Macro Escape
  425.           #250 Return   *  Char Unlikely to be Found
  426.           DelLine       *  Erase old prompt
  427.           Pause Return  *  Allow User to Enter Repl Text
  428.           "LN" Return   *  Local, No Prompt Replace
  429.         MarkLine        * Mark first line
  430.         PrevPosition    * Return to beg of where block was
  431.         ShiftRight      * Shift all lines to right
  432.         BegLine         * Move cursor to column 1
  433.         GotoBlockEnd    * Move to 1st char of last line
  434.         MarkColumn      * Mark 1st character column
  435.         PrevPosition    * Return to first line
  436.         BegLine         * Needed for single-line blocks
  437.         MarkColumn      * Finish marking block
  438.         FillBlock       * Fill First Column with Char
  439.           #250 Return   *  Searched For Above
  440.         RepeatFind      * Repeat the FindReplace
  441.         GotoBlockEnd    * Go to the last line
  442.         UnmarkBlock     * Unmark the block
  443.         BegLine         * Return to beginning of line
  444.         CursorDown      * Go to next line
  445. *
  446. * 42 bytes Sat  07-27-1991  23:43:18 (JG)
  447.  
  448. * QCONFIG.DAT version of @8 above.  Uncomment the lines and merge
  449. * them together into a single line before placing in QCONFIG.DAT.
  450.  
  451. * @8 MacroBegin CursorRight GotoBlockBeg JTrue BLK: DropAnchor
  452. * GotoBlockBeg BLK: GotoBlockEnd FindReplace #250 Return DelLine
  453. * Pause Return "LN" Return MarkLine PrevPosition ShiftRight BegLine
  454. * GotoBlockEnd MarkColumn PrevPosition BegLine MarkColumn FillBlock
  455. * #250 Return RepeatFind GotoBlockEnd UnmarkBlock BegLine CursorDown
  456.  
  457.